//
//  Player.m
//  ToYourHeartNews
//
//  Created by XJing on 16/1/20.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥. All rights reserved.
//

#import "Player.h"

@implementation Player
+(Player *)shareInstance:(AVPlayerItem *)playerItem
{
//    static Player *player = nil;
//    if (!player) {
//        player = [Player playerWithPlayerItem:playerItem];
//    }
//    [player replaceCurrentItemWithPlayerItem:playerItem];
//    return player;
    static Player *player = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [player pause];
        player = [Player playerWithPlayerItem:playerItem];
    });
    [player replaceCurrentItemWithPlayerItem:playerItem];
    return player;
}
@end
